#include <sstream>
#include "player.hpp"
#include "hud.hpp"
#include <iostream>

Hud::Hud(Graphicengine *g, float l, Player *p) : Animation(g, l), plr(p)
{

}

Hud::~Hud()
{

}

bool	Hud::tick(float)
{
	return (true);
}

void	Hud::draw()
{
	std::ostringstream	str;
	vec<float, 2>		l;
	vec<float, 2>		s;
	vec<float, 4>		c = {{1.0f, 0.5f, 0.0f, 1.0f}};

	l = *ge->cam;
	l[0] -= ge->screensize[0] / 2.0f - 32.0f;
	l[1] += ge->screensize[1] / 2.0f - 5 * 32.0f;
	s = 0.5;
	str << "Score " << plr->score;
	ge->draw_text(str.str(), l, s, c);
	str.str("");
	l[1] += 32.0f;

	str << "Dose " << plr->dose;
	ge->draw_text(str.str(), l, s, c);
	str.str("");
	l[1] += 32.0f;

	str << "Tolerance " << plr->tolerance;
	ge->draw_text(str.str(), l, s, c);
	str.str("");
	l[1] += 32.0f;

	str << "Power " << plr->firerate;
	ge->draw_text(str.str(), l, s, c);
}
